<?php
namespace app\mobile\controller;

use app\model\Record; 
use app\model\Util; 
use app\model\Theme; 

class Getbasebeilai extends Base
{
    public function Getbasebeilai()
    {
global $_G, $_P;
$fans = $this->checkuser();
$system=$_G['system'];
$themeid = intval($_P['themeid']);
if($themeid <= 0){
    return_msg('活动入口不正确');
}
$theme = Theme::getThemeById($themeid);
if(empty($theme['id'])){
    die(Util::showError("请确认活动地址是否正确"));
    return;
}
$config = 	Theme::getConfig($themeid);
if ($system['ispresale']==1){
    $theme = Theme::presale_theme($theme,$config);
}
$nowgroupneednum = $_P['neednum'];
$themyrecordid = $_P['myid'];
$is_finish = false;
if (empty($themyrecordid)){
    if ($nowgroupneednum==0){
        if ($config['maxcountall']>1){
            if ($config['tuanmode']==0 || $config['tuanmode']==2){
                $is_finish = true;
            }
        }
    }
}
$recordid = $_P['record'];

//获取定单信息：theMyRecord
extract(Record::getTheMyRecord($system,$fans,$recordid,$config,$themeid));

//获取要显示的团明细
extract(Record::getShowRecord($system,$recordid,$config,$themeid));

$btnnum = 0;

extract(Theme::get_footmenu($system,$theme,$config,$fans,$themeid,$themyrecord,$themyrecordid,$showrecord,$nowgroupneednum,$is_finish,$icon,false));
// 底部按扭URL参数
// 10补余款
// 999邀请好友
// 11我的定单
// 12核销定单
// 1开新团
// 2显示团信息 20加入团
// 3单买
// 4第二个拼团价
// 5第三个拼团价
// 13加入团（此团已满）
// 41预约摄摄
// 42查看预约



if ($system['softstyle']==109){
    //    教培
    $goto_url = array(
        10 => $_G['siteroot'] . createMobileUrl('wx', array('themeid'=>$themeid,'joinid'=>8,'from'=>'mobile','r'=>'education.index.course')),
        999 => "javascript:showPoster();",
        11 => $_G['siteroot'] . createMobileUrl("mypay", array("themeid" => $themeid)),
        12 => $_G['siteroot'] . createMobileUrl("myorder", array("themeid" => $themeid)),
        1 => $_G['siteroot'] . createMobileUrl('wx', array('themeid'=>$themeid,'joinid'=>0,'from'=>'mobile','r'=>'education.index.course')),
        13 => "javascript:show_tuan();",
        2 => "javascript:show_tuan();",
        20 => $_G['siteroot'] . createMobileUrl('wx', array('themeid'=>$themeid,'joinid'=>1,'recordid'=>$recordid,'from'=>'mobile','r'=>'education.index.course')),
        3 => $_G['siteroot'] . createMobileUrl('wx', array('themeid'=>$themeid,'joinid'=>9,'from'=>'mobile','r'=>'education.index.course')),
    );
}else{
    //    贝莱
    $goto_url = array(
        10 => $_G['siteroot'] . createMobileUrl('wx', array('themeid'=>$themeid,'joinid'=>8,'from'=>'mobile','r'=>'beilai.index.course')),
        999 => "javascript:showPoster();",
        11 => $_G['siteroot'] . createMobileUrl("mypay", array("themeid" => $themeid)),
        12 => $_G['siteroot'] . createMobileUrl("myorder", array("themeid" => $themeid)),
        1 => $_G['siteroot'] . createMobileUrl('wx', array('themeid'=>$themeid,'joinid'=>0,'from'=>'mobile','r'=>'beilai.index.course')),
        13 => "javascript:show_tuan();",
        2 => "javascript:show_tuan();",
        20 => $_G['siteroot'] . createMobileUrl('wx', array('themeid'=>$themeid,'joinid'=>1,'recordid'=>$recordid,'from'=>'mobile','r'=>'beilai.index.course')),
        3 => $_G['siteroot'] . createMobileUrl('wx', array('themeid'=>$themeid,'joinid'=>9,'from'=>'mobile','r'=>'beilai.index.course')),
    );
}

$result=array();

if (empty($themyrecordid) && !empty($showrecord)){
    $txt = "<div class=\"screen\" id=\"screen\" style='display: none'></div><div style='margin-left: -3.76rem;' class=\"teamAlt\">\n";
    $txt .= " <div class=\"teamTitle\">\n";
    $txt .= "     选择参与方式\n";
    $txt .= "       <span class=\"closeB\" onclick=\"closescreen()\"></span>\n";
    $txt .= "   </div>\n";
    $txt .= "   <div class=\"peoBox\">\n";
    $txt .= "     <ul>\n";
    $txt .= "         <li><img src=\"" . tomedia($showrecord['avatar']) ."\"><span class=\"tagpeo\">团长</span></li>\n";
    if (!empty($detaillist)){
        foreach ($detaillist as $cindexno => $item) {
            if ($cindexno==18){
                $txt .= "           <li><img src=\"".$_G['URL']['YX2020_CSS']."images/useramore.png\"></li>\n";
            }elseif ($cindexno<18) {
                $txt .= "                     <li>\n";
                $txt .= "                         <img src=\"" . tomedia($item['avatar']) . "\">\n";
                $txt .= "                     </li>\n";
            }
        }
    }

    if (!empty($num_arr)){
        foreach ($num_arr as $cindexno => $item) {
            $txt .= "           <li><img src=\"".$_G['URL']['YX2020_CSS']."images/usera.png\"></li>\n";
        }
    }
    $txt .= "       </ul>\n";
    $txt .= "       <div class=\"relesPeo\">\n";

    if ($nowgroupneednum!=0){
        $txt .= "          <span>此团仅剩" . $nowgroupneednum . "个名额，您现在付款即可加入此团</span>\n";
    }else{
        if ($config['tuanmode']==0 || $config['tuanmode']==2){
            $txt .= "          <span>此团已团成功</span>\n";
        }elseif ($config['tuanmode']==1 || $config['tuanmode']==3){
            $txt .= "          <span>此团已团成功,还可继续加入,共享福利</span>\n";
        }
    }

    $txt .= "       </div>\n";



    $txt .= "   </div>\n";
    $txt .= "   <div class=\"controlBtn\">\n";

    if ($config['groupprice2'] == '0.00') {
        $formtextcenternew = str_replace("<h2>", "", $formtextcenternew);
        $formtextcenternew = str_replace("</h2>", "", $formtextcenternew);
        $formtextcenternew = str_replace("<p>", "", $formtextcenternew);
        $formtextcenternew = str_replace("</p>", "", $formtextcenternew);

        $formtextright = str_replace("<h2>", "", $formtextright);
        $formtextright = str_replace("</h2>", "", $formtextright);
        $formtextright = str_replace("<p>", "", $formtextright);
        $formtextright = str_replace("</p>", "", $formtextright);
    }

    //贝莱 加入团的样式修正
    if ($system['softstyle']==108){
        if ($system['bottom_jiage']!=0){
            $formtextcenternew = "<h2>我要开团</h2>";
            $formtextright = "<h2>立即加入</h2>";
        }else{
            if (strpos($formtextcenternew,'<h2>')!==false && strpos($formtextcenternew,'<p>')!==false){
                //同时存在h2以及p
                $formtextcenternew = str_replace("<h2>", "<h2 style='height: .5rem;line-height: .5rem;'>", $formtextcenternew);
                $formtextcenternew = str_replace("<p>", "<p style='height: .5rem;line-height: .5rem;'>", $formtextcenternew);
            }
            if (strpos($formtextright,'<h2>')!==false && strpos($formtextright,'<p>')!==false){
                //同时存在h2以及p
                $formtextright = str_replace("<h2>", "<h2 style='height: .5rem;line-height: .5rem;'>", $formtextright);
                $formtextright = str_replace("<p>", "<p style='height: .5rem;line-height: .5rem;'>", $formtextright);
            }
        }

    }

    if ($nowgroupneednum!=0){
        if ($system['softstyle']==108 && $system['bottom_jiage']!=0){
            $tmp_formtextright = '立即加入';
            if(strpos($config['formtextright'],'#br') !== false){
                $tmp_formtextright = substr($config['formtextright'],strpos($config['formtextright'],'#br')+3);
            }
            $grouprice1_url = $_G['siteroot'] . createMobileUrl('wx', array('themeid'=>$themeid,'joinid'=>61,'recordid'=>$recordid,'from'=>'mobile','r'=>'beilai.index.course','grouprice'=>1));
            $grouprice2_url = $_G['siteroot'] . createMobileUrl('wx', array('themeid'=>$themeid,'joinid'=>62,'recordid'=>$recordid,'from'=>'mobile','r'=>'beilai.index.course','grouprice'=>2));
            $txt .= "<a href='".$grouprice1_url."'><h2>￥".$config['groupprice']."</h2><p>".$tmp_formtextright."</p></a>";
            $txt .= "<a href='".$grouprice2_url."'><h2>￥".$config['groupprice2']."</h2><p>".$tmp_formtextright."</p></a>";
            if ($system['bottom_jiage']==2){
                $grouprice3_url = $_G['siteroot'] . createMobileUrl('wx', array('themeid'=>$themeid,'joinid'=>63,'recordid'=>$recordid,'from'=>'mobile','r'=>'beilai.index.course','grouprice'=>3));
                $txt .= "<a href='".$grouprice3_url."'><h2>￥".$config['groupprice3']."</h2><p>立即加入</p></a>";
            }
        }else{
            $txt .= "       <a style='height:.95rem;' href=\"". $goto_url[20]."\">".$formtextright."</a>\n";
            if ($config['tuanmode']!=2 && $config['tuanmode']!=3){
                $txt .= "     <a style=\"background: #d2d5d6; color: #656464;height:.95rem;\" href=\"". $goto_url[1]."\">".$formtextcenternew."</a>\n";
            }else{
                $txt .= "     <a style=\"background: #d2d5d6; color: #656464;\" href=\"javascript:;\" onclick=\"tips('此团未满,只可加入团')\">".$formtextcenternew."</a>\n";
            }
        }

    }else{
        if ($config['tuanmode']==0 || $config['tuanmode']==2){
            $txt .= "     <a style=\"background: linear-gradient(to right,#f82079,#fe878e); color: #FFFFFF;\" href=\"". $goto_url[1]."\">".$formtextcenternew."</a>\n";
            $txt .= "     <a style=\"background: #d2d5d6; color: #656464;height: .95rem;\" href=\"javascript:;\" onclick=\"tips('此团已满,请开新团')\" ><h2 style=\"font-size: .28rem; line-height: .4rem; margin-top: .11rem;\">".$formtextright."</h2><p style=\"font-size: .2rem;line-height: .4rem;\">（此团已满,请开新团）</p></a>\n";
        }elseif ($config['tuanmode']==1 || $config['tuanmode']==3){
            $txt .= "     <a style=\"background: #d2d5d6; color: #656464;\" href=\"". $goto_url[1]."\">".$formtextcenternew."</a>\n";
            $txt .= "     <a style=\"height: .95rem;\" href=\"". $goto_url[20]."\" ><h2 style=\"font-size: .28rem; line-height: .4rem; margin-top: .11rem;\">".$formtextright."</h2><p style=\"font-size: .2rem;line-height: .4rem;\">（此团已团成功,还可加入）</p></a>\n";
        }
    }

    $txt .= "   </div> \n";


    $txt .= "</div>\n";



    $result['teamAlt'] = Theme::encode($txt);
}


$btnnum = 0;

$txt = "";
$top_txt = "";
$sum_total = 0;//判断底部按钮中的个数
if ($system['softstyle']==109){
//    教培
    $goto_url = array(
        10 => $_G['siteroot'] . createMobileUrl('wx', array('themeid'=>$themeid,'joinid'=>8,'from'=>'mobile','r'=>'education.index.course')),
        999 => "javascript:showPoster();",
        11 => $_G['siteroot'] . createMobileUrl("mypay", array("themeid" => $themeid)),
        12 => $_G['siteroot'] . createMobileUrl("myorder", array("themeid" => $themeid)),
        1 => $_G['siteroot'] . createMobileUrl('wx', array('themeid'=>$themeid,'joinid'=>0,'from'=>'mobile','r'=>'education.index.course')),
        13 => "javascript:show_tuan();",
        2 => "javascript:show_tuan();",
        20 => $_G['siteroot'] . createMobileUrl('wx', array('themeid'=>$themeid,'joinid'=>1,'recordid'=>$recordid,'from'=>'mobile','r'=>'education.index.course')),
        3 => $_G['siteroot'] . createMobileUrl('wx', array('themeid'=>$themeid,'joinid'=>9,'from'=>'mobile','r'=>'education.index.course')),
    );


    $mine_url = "/".createMobileUrl('wx', array('themeid'=>$themeid,'from'=>'mobile','r'=>'education.index.mine'));
    $top_txt .= '<div class="footer">'.PHP_EOL;
    $top_txt .= '<a href="'.$mine_url.'" class="home">我的</a>'.PHP_EOL;
    $top_txt .= '<a href="javascript:void(0)" class="kf" onclick="showService()">客服</a>'.PHP_EOL;



    if ($theme['status']==2 && empty($themyrecordid) && $config['isshow_end_footermenu']!=1){
        $top_txt .= '<div class="footBtn">'.PHP_EOL;
        $txt = $top_txt.$txt;

        $txt .= '<a href="javascript:;">活动已结束</a>'.PHP_EOL;
        $txt .= '</div>'.PHP_EOL;
        $txt .= '</div>'.PHP_EOL;

    }else if ($theme['status']==1 && TIMESTAMP < $theme['begintime']){
        $top_txt .= '<div class="footBtn">'.PHP_EOL;
        $txt = $top_txt.$txt;

        $txt .= '<a href="javascript:;" class="controlHeight">'.PHP_EOL;
        $txt .= '<span style="color:'.$config['formcolorcentertext'].';font-size: .24rem;">距离开始时间:<i id="time_begin"></i></span>'.PHP_EOL;
        $txt .= '<div>活动暂未开始</div>'.PHP_EOL;
        $txt .= '</a>'.PHP_EOL;
        $txt .= '</div>'.PHP_EOL;
        $txt .= '</div>'.PHP_EOL;
    }else{
        $item_width = '';
        if (!empty($bottombut['left']['txt']) && !empty($bottombut['center']['txt']) && !empty($bottombut['right']['txt'])){
            $item_width = 'width:33.33%;';
        }
        if (!empty($bottombut['left']['txt'])){
            $txt .= '<a href="'.$goto_url[$bottombut['left']['url']].'" style="display: flex;flex-direction: column;justify-content: center;align-items: center;height: .8rem;line-height: .8rem;'.$item_width.'">';
            if (!empty($bottombut['left']['txt'][0])){
                $temp_btm_txt0 = $bottombut['left']['txt'][0];
                $arr2 = explode('h2>',strip_tags($temp_btm_txt0,'<h2>'));
                $arr1 = array_filter($arr2);
                if ($arr1[0]=='<'){
                    unset($arr1[0]);
                }
                $arr1 = array_values($arr1);
                $d1 = strip_tags($arr1[0]);
                if (count($arr1)==1){
                    if (!$bottombut['left']['txt'][1]){
                        $txt .= '<div style="height: .8rem;line-height: .8rem;font-size: .28rem;display: flex;color:' .$config['formcolorlefttext'].'">'.$d1.'</div>';
                    }else{
                        $txt .= '<div style="height: .3rem;line-height: .3rem;font-size: .28rem;display: flex;color:' .$config['formcolorlefttext'].'">'.$d1.'</div>';
                    }
                }else{
                    $d2 = strip_tags($arr1[1]);
                    $txt .= '<div style="height: .3rem;line-height: .3rem;font-size: .24rem;display: flex;color:' .$config['formcolorlefttext'].'">'.$d1.'</div>';
                    $txt .='<div style="height: .37rem;line-height: .37rem;font-size: .24rem;display: flex;color: '.$config['formcolorlefttext'].'">'.$d2.'</div>';
                }
            }
            if ($bottombut['left']['txt'][1]){
                if ($bottombut['left']['txt'][0]){
                    $txt.= '<div style="height: .4rem;line-height: .4rem;font-size: .28rem;display: flex;color:' .$config['formcolorlefttext'].'">'.$bottombut['left']['txt'][1].'</div>';
                }else{
                    $txt.= '<div style="height: .7rem;line-height: .7rem;font-size: .28rem;display: flex;color:' .$config['formcolorlefttext'].'">'.$bottombut['left']['txt'][1].'</div>';
                }
            }
            $txt .= '</a>'.PHP_EOL;
            $sum_total+=1;
        }
        if (!empty($bottombut['center']['txt'])){
            $two_btn = $item_width;
            if ($two_btn){
                $two_btn.= 'float:left;border-radius:0;';
            }
            $txt .= '<a href="'.$goto_url[$bottombut['center']['url']].'" style="display: flex;flex-direction: column;justify-content: center;align-items: center;height: .8rem;line-height: .8rem;'.$two_btn.'">';
            if (!empty($bottombut['center']['txt'][0])){
                $temp_btm_txt0 = $bottombut['center']['txt'][0];
                $arr2 = explode('h2>',strip_tags($temp_btm_txt0,'<h2>'));
                $arr1 = array_filter($arr2);
                if ($arr1[0]=='<'){
                    unset($arr1[0]);
                }
                $arr1 = array_values($arr1);
                $d1 = strip_tags($arr1[0]);
                if (count($arr1)==1){
                    if (!$bottombut['center']['txt'][1]){
                        $txt .= '<div style="height: .7rem;line-height: .7rem;font-size: .28rem;display: flex;color:' .$config['formcolorcentertext'].'">'.$d1.'</div>';
                    }else{
                        $txt .= '<div style="height: .3rem;line-height: .3rem;font-size: .28rem;display: flex;color:' .$config['formcolorcentertext'].'">'.$d1.'</div>';
                    }

                }else{
                    $d2 = strip_tags($arr1[1]);
                    $txt .= '<div style="height: .3rem;line-height: .3rem;font-size: .24rem;display: flex;color:' .$config['formcolorcentertext'].'">'.$d1.'</div>';
                    $txt .='<div style="height: .37rem;line-height: .37rem;font-size: .24rem;display: flex;color: '.$config['formcolorcentertext'].'">'.$d2.'</div>';
                }
            }
            if ($bottombut['center']['txt'][1]){
                if ($bottombut['left']['txt'][0]){
                    $txt.= '<div style="height: .4rem;line-height: .4rem;font-size: .28rem;display: flex;color:' .$config['formcolorcentertext'].'">'.$bottombut['center']['txt'][1].'</div>';
                }else{
                    $txt.= '<div style="height: .7rem;line-height: .7rem;font-size: .28rem;display: flex;color:' .$config['formcolorcentertext'].'">'.$bottombut['center']['txt'][1].'</div>';
                }
            }
            $txt .=  "</a>\n";
            $sum_total+=1;
        }
        if (!empty($bottombut['right']['txt'])){
            $third_btn = $item_width;
            if (!empty($bottombut['center']['txt'])){
                $third_btn.= 'border-radius:0 .46rem .46rem 0;';
            }
            $txt .= '<a href="'.$goto_url[$bottombut['right']['url']].'" style="display: flex;flex-direction: column;justify-content: center;align-items: center;height: .8rem;line-height: .8rem;'.$third_btn.'">';
            if (!empty($bottombut['right']['txt'][0])){
                $temp_btm_txt0 = $bottombut['right']['txt'][0];
                $arr2 = explode('h2>',strip_tags($temp_btm_txt0,'<h2>'));
                $arr1 = array_filter($arr2);
                if ($arr1[0]=='<'){
                    unset($arr1[0]);
                }
                $arr1 = array_values($arr1);
                $d1 = strip_tags($arr1[0]);
                if (count($arr1)==1){
                    if (!$bottombut['right']['txt'][1]){
                        $txt .= '<div style="height: .7rem;line-height: .7rem;font-size: .28rem;display: flex;color:' .$config['formcolorrighttext'].'">'.$d1.'</div>';
                    }else{
                        $txt .= '<div style="height: .3rem;line-height: .3rem;font-size: .28rem;display: flex;color:' .$config['formcolorrighttext'].'">'.$d1.'</div>';
                    }
                }else{
                    $d2 = strip_tags($arr1[1]);
                    $txt .= '<div style="height: .3rem;line-height: .3rem;font-size: .24rem;display: flex;color:' .$config['formcolorrighttext'].'">'.$d1.'</div>';
                    $txt .='<div style="height: .37rem;line-height: .37rem;font-size: .24rem;display: flex;color: '.$config['formcolorrighttext'].'">'.$d2.'</div>';
                }
            }
            if ($bottombut['right']['txt'][1]){

                if ($bottombut['left']['txt'][0]){
                    $txt.= '<div style="height: .4rem;line-height: .4rem;font-size: .28rem;display: flex;color:' .$config['formcolorrighttext'].'">'.$bottombut['right']['txt'][1].'</div>';
                }else{
                    $txt.= '<div style="height: .7rem;line-height: .7rem;font-size: .28rem;display: flex;color:' .$config['formcolorrighttext'].'">'.$bottombut['right']['txt'][1].'</div>';
                }
            }
            $txt .=  "</a>\n";
            $sum_total+=1;
        }
        if ($sum_total>1){
            $top_txt .= '<div class="footBtn twoBtn">'.PHP_EOL;
        }else{
            $top_txt .= '<div class="footBtn">'.PHP_EOL;
        }
        $txt = $top_txt.$txt;

        $txt .= '</div>'.PHP_EOL;
        $txt .= '</div>'.PHP_EOL;
    }
}else{
//    贝莱
    $goto_url = array(
        10 => $_G['siteroot'] . createMobileUrl('wx', array('themeid'=>$themeid,'joinid'=>8,'from'=>'mobile','r'=>'beilai.index.course')),
        999 => "javascript:showPoster();",
        11 => $_G['siteroot'] . createMobileUrl("mypay", array("themeid" => $themeid)),
        12 => $_G['siteroot'] . createMobileUrl("myorder", array("themeid" => $themeid)),
        1 => $_G['siteroot'] . createMobileUrl('wx', array('themeid'=>$themeid,'joinid'=>0,'from'=>'mobile','r'=>'beilai.index.course')),
        17 => $_G['siteroot'] . createMobileUrl('index', array('themeid'=>$themeid,'joinid'=>0)),//打开好友 我要开团
        13 => "javascript:show_tuan();",
        2 => "javascript:show_tuan();",
        20 => $_G['siteroot'] . createMobileUrl('wx', array('themeid'=>$themeid,'joinid'=>1,'recordid'=>$recordid,'from'=>'mobile','r'=>'beilai.index.course')),
        3 => $_G['siteroot'] . createMobileUrl('wx', array('themeid'=>$themeid,'joinid'=>9,'from'=>'mobile','r'=>'beilai.index.course')),

        4 => $_G['siteroot'] . createMobileUrl('wx', array('themeid'=>$themeid,'joinid'=>4,'from'=>'mobile','r'=>'beilai.index.course')),//第二个价格
        5 => $_G['siteroot'] . createMobileUrl('wx', array('themeid'=>$themeid,'joinid'=>5,'from'=>'mobile','r'=>'beilai.index.course')),//第三个价格
    );

    $txt .=  "<div class=\"footer\">\n";
    $txt .=  "   <div class=\"menus\">\n";
    $txt .=  "        <a class=\"menu1\" href=\"/";
    $txt .=  createMobileUrl('wx', array('themeid'=>$themeid,'from'=>'mobile','r'=>'beilai.index.mine'));
    $txt .=  "\">\n";
    $txt .=  "           <img src=\"" . $_G['URL']['BEILAI_IMG'] ."/b_icon1.png\">\n";
    $txt .=  "           <span>我的</span>\n";
    $txt .=  "       </a>\n";
    $txt .=  "       <div class=\"menu2\" onclick=\"showService()\">\n";
    $txt .=  "           <img src=\"" . $_G['URL']['BEILAI_IMG'] ."/b_icon2.png\">\n";
    $txt .=  "           <span>客服</span>\n";
    $txt .=  "       </div>\n";
    $txt .=  "   </div>\n";
    if ($theme['status']==2 && empty($themyrecordid) && $config['isshow_end_footermenu']!=1){
        $txt .=  "   <div class=\"button over\">\n";
        $txt .=  "       <img src=\"" . $_G['URL']['BEILAI_IMG'] ."/imoj.png\">\n";
        $txt .=  "       <span>活动已结束</span>\n";
        $txt .=  "   </div>\n";
    }else if ($theme['status']==1 && TIMESTAMP < $theme['begintime']){
        $txt .=  "   <div class=\"button start_theme\">\n";
        $txt .=  "       <span>活动暂未开始</span>\n";
        $txt .=  "       <span class=\"s\">距离开始时间：<i id=\"time_begin\"></i></span>\n";
        $txt .=  "   </div>\n";
    }else {
        $txt .=  "           <div class=\"btns\">\n";
        if (!empty($bottombut['left']['txt'])){
            $txt .=  "               <a href=\"".$goto_url[$bottombut['left']['url']]."\">";
            if (!empty($bottombut['left']['txt'][0])) {
                $txt .= "<span>" . $bottombut['left']['txt'][0] . "</span>";
            }
            if (!empty($bottombut['left']['txt'][1])) {
                $txt .= "<span>" . $bottombut['left']['txt'][1] . "</span>";
            }
            $txt .=  "</a>\n";
        }
//        if (!empty($bottombut['left']['center'])){
        if (!empty($bottombut['center']['txt'])){
            $txt .=  "<a href=\"".$goto_url[$bottombut['center']['url']]."\">";
            if (!empty($bottombut['center']['txt'][0])) {
                if ($showrecord && $system['bottom_jiage']!=0){
                    $txt .= "<h2>我要开团</h2>";
                }else{
                    $txt .= "<span>" . $bottombut['center']['txt'][0] . "</span>";
                }
            }
            if (!empty($bottombut['center']['txt'][1])) {
                $txt .= "<span>" . $bottombut['center']['txt'][1] . "</span>";
            }
            $txt .=  "</a>\n";
        }

        if (!empty($bottombut['right']['txt'])){
            $txt .=  "<a href=\"".$goto_url[$bottombut['right']['url']]."\">";
            if (!empty($bottombut['right']['txt'][0])) {
                if ($showrecord && $system['bottom_jiage']!=0 && !$themyrecordid){
                    $txt .= "<h2>立即加入</h2>";
                }else{
                    $txt .= "<span>" . $bottombut['right']['txt'][0] . "</span>";
                }

            }
            if (!empty($bottombut['right']['txt'][1])) {
                $txt .= "<span>" . $bottombut['right']['txt'][1] . "</span>";
            }
            $txt .=  "</a>\n";
        }

        $txt .=  "           </div>\n";

    }

}
$result['footmenu'] = Theme::encode($txt);

if ($system['softstyle']==108 || $system['softstyle']==109){
    if($config['iscomm']==1 || $config['shopsort'] > 0) {
        $txt =  "";
        if (!empty($config['commlistimgbg'])) {
            $txt .=  "<style type=\"text/css\"> .phb{ background: url('" .$config['commlistimgbg']."') center top no-repeat;} </style>";
        }

        $txt .=  " <div class=\"phb\">\n";
        $txt .=  "   <div class=\"phbtitle\">\n";
        if (empty($config['commlistimg'])) {
            if ($system['isCommPoints']==1){
                $txt .=  "     <img src=\"" . $_G['URL']['FCPDD_CSS'] . "images/phbjf.png\">\n";
            }else{
                $txt .=  "     <img src=\"" . $_G['URL']['FCPDD_CSS'] . "images/phb.png\">\n";
            }
        }else{
            $txt .=  "     <img src=\"" . $config['commlistimg'] . "\">\n";
        }
        $txt .=  " </div>\n";
        $txt .=  " <div class=\"phbBar\">\n";
        $txt .=  "    <!-- <div class=\"titImg\">\n";
        $txt .=  "       <img src=\"" .$_G['URL']['YX2020_CSS']."images/titimg.png\">\n";
        $txt .=  "    </div> -->\n";

        if ($config['iscommshow24']==1){
            $txt .=  "    <div class=\"chosB\">\n";
            $txt .=  "       <span id='chosphbA' class=\"on2\" onclick=\"chosphbA()\">总&#25490;行&#27036;</span>\n";
            $txt .=  "       <span id='chosphbB' onclick=\"chosphbB()\">24小时&#25490;行&#27036;</span>\n";
            $txt .=  "    </div>\n";
        }
        $txt .=  "    <div class=\"tableBox\">\n";
        $txt .=  "       <table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">\n";
        $txt .=  "           <tbody>\n";
        if ($config['shopsort'] > 0) {
            $txt .= "        <tr>\n";
            $txt .= "            <th>&#25490;&#21517;</th>\n";
            $txt .= "               <th>名称</th>\n";
            if ($config['isrankrenshu'] == 0) {
                $txt .= "               <th>人气值</th>\n";
            }
            if ($config['isrankqianshu'] == 0) {
                $txt .= "               <th>选择</th>\n";
            }
            $txt .= "           </tr>\n";
        }else{
            $txt .= "        <tr>\n";
            $txt .= "            <th>&#25490;&#21517;</th>\n";
            $txt .= "               <th>&#23458;&#25143;&#20449;&#24687;</th>\n";
            if ($config['isrankrenshu'] == 0) {
                $txt .= "               <th>&#25968;&#37327;</th>\n";
            }
            if ($config['isrankqianshu'] == 0 && $system['isCommPoints']==1) {
                $txt .= "               <th>积分</th>\n";
            }elseif ($config['isrankqianshu'] == 0) {
                $txt .= "               <th>&#37329;&#39069;</th>\n";
            }
            $txt .= "           </tr>\n";
        }
        if (!empty($commslist)) {
            foreach ($commslist as $cindexno => $row) {
                $cindex = $cindexno + 1;
                $txt .=  "           <tr>\n";
                if ($cindex<4){
                    $txt .=  "            <td>< img src=\"" . $_G['URL']['YX2020_CSS'] . "images/icon1" . $cindex . ".png\"></td>\n";
                }else{
                    $txt .=  "            <td>" . $cindex . "</td>\n";
                }
                $txt .=  "               <td style=\"text-align:left;\">< img src=\"" . tomedia($row['avatar']) . "\" class=\"baby\">";
                if (empty($row['nickname'])){
                    $txt .=  "null" . $row['uid'];
                }else{
                    $txt .=  mb_substr($row['nickname'],0,8,'utf-8');
                }
                $txt .=  "</td>\n";
                if ($config['isrankrenshu']==0){
                    $txt .=  "               <td>" . $row['commcount'] . "人</td>\n";
                }
                if ($config['isrankqianshu'] == 0 && $system['isCommPoints']==1) {
                    $txt .=  "               <td><span>" . $row['feesum'] ."分</span></td>\n";
                }elseif ($config['isrankqianshu'] == 0) {
                    $txt .=  "               <td><span>￥" . $row['feesum'] ."</span></td>\n";
                }
                $txt .=  "           </tr>\n";
            }
        }
        $txt .=  "       </tbody></table>\n";
        $txt .=  "       <table width=\"100%\" class=\"dn\" cellpadding=\"0\" cellspacing=\"0\">\n";
        $txt .=  "           <tbody><tr>\n";
        $txt .=  "               <th>排名</th>\n";
        $txt .=  "               <th>客户信息</th>\n";
        if ($config['isrankrenshu']==0){
            $txt .=  "               <th>数量</th>\n";
        }
        if ($config['isrankqianshu']==0){
            $txt .=  "               <th>金额</th>\n";
        }
        $txt .=  "           </tr>\n";
        if (!empty($commslisttoday)) {
            foreach ($commslisttoday as $cindexno => $row) {
                $cindex = $cindexno + 1;
                $txt .=  "           <tr>\n";
                if ($cindex<4){
                    $txt .=  "            <td>< img src=\"" . $_G['URL']['FCPDD_CSS'] . "images/icon1" . $cindex . ".png\"></td>\n";
                }else{
                    $txt .=  "            <td>" . $cindex . "</td>\n";
                }
                $txt .=  "               <td style=\"text-align:left;\">< img src=\"" . tomedia($row['avatar']) . "\" class=\"baby\">";
                if (empty($row['nickname'])){
                    $txt .=  "null" . $row['uid'];
                }else{
                    $txt .=  mb_substr($row['nickname'],0,5,'utf-8');
                }
                $txt .=  "</td>\n";
                if ($config['isrankrenshu']==0){
                    $txt .=  "               <td>" . $row['commcount'] . "人</td>\n";
                }
                if ($config['isrankqianshu']==0){
                    $txt .=  "               <td><span>￥" . $row['feesum'] ."</span></td>\n";
                }
                $txt .=  "           </tr>\n";
            }
        }
        $txt .=  "       </tbody></table>\n";

        $txt .=  "    </div>\n";
        $txt .=  " </div>\n";
        if ($commssum>0 && $config['ismycomm']==0 || $config['ismycomm']==1){
            if ($system['isCommPoints']==1){
                $txt .=  "       <a href= '" . $_G['siteroot'].createMobileUrl('mycomm',array('themeid'=>$themeid)) ."\" class=\"myhold\" style=\"background: #ec1f1a; margin-top: 6px;\" >我的积分<span>【" . $commssum ."分】</span></a >\n";
            }else{
                $txt .=  "       <a href=\"" . $_G['siteroot'].createMobileUrl('mycomm',array('themeid'=>$themeid)) ."\" class=\"myhold\" style=\"background: #ec1f1a; margin-top: 6px;\" >我的红包<span>￥" . $commssum ."</span></a >\n";
            }
        }
        $txt .=  "</div>\n";
        $txt2 = $txt;

        $result['phb'] = Theme::encode($txt2);
    }
}


if (!empty($showrecord) && $system['softstyle']!=107){
    $txt =  " <div class=\"pin\">\n";
    $txt .=  " 	<ul>\n";
    $txt .= "                     <li>\n";
    $txt .= "                         <img src=\"" . tomedia($showrecord['avatar']) ."\">\n";
    $txt .= "                         <span class=\"homez\"><img src=\"" . $_G['URL']['FCPDD_CSS'] . "images/homez.png \"></span>\n";
    $txt .= "                     </li>\n";

    if (!empty($detaillist)){
        foreach ($detaillist as $cindexno => $item) {
            $txt .= "                     <li>\n";
            $txt .= "                         <img src=\"" . tomedia($item['avatar']) . "\">\n";
            if ($cindexno==0){
                $txt .= "                         <span class=\"bbsoft\"><img src=\"" . $_G['URL']['FCPDD_CSS'] . "images/soft.png\"></span>\n";
            }
            $txt .= "                     </li>\n";

        }
    }
    if (!empty($num_arr)){
        foreach ($num_arr as $cindexno => $item) {
            $txt .= "                     <li>\n";
            $txt .= "                         <img src=\"" . $_G['URL']['FCPDD_CSS'] . "images/ask.png\">\n";
            $txt .= "                     </li>\n";

        }
    }
    //
    $txt .=  "   </ul>\n";
    if (empty($themyrecordid)){
//        $txt .=  "   <a href=\"javascript:;\" onclick=\"show_info(2)\"  class=\"subBtn\">";
        if ($system['softstyle']==108 && $system['bottom_jiage']!=0){
            $txt .=  "   <a href='".$goto_url[13]."'   class='subBtn'>";
        }else{
            $txt .=  "   <a href='".$goto_url[20]."'   class='subBtn'>";
        }

        if ($nowgroupneednum!=0){
            $txt .= "还差<span>" . $nowgroupneednum . "</span>人 立即加入";

        }else{
            if ($config['maxcountall']>1){
                if ($config['tuanmode']==0 || $config['tuanmode']==2){
                    $txt .= "          — 已拼成功 —\n";
                    $is_finish = true;
                }elseif ($config['tuanmode']==1 || $config['tuanmode']==3){
                    $txt .= "          — 已拼成,还可继续加入,共享福利 —\n";
                }
            }
        }
    }else{
        $txt .=  "   <a href=\"javascript:;\" onclick=\"showPoster()\" class=\"subBtn\">";
        if ($nowgroupneednum!=0){
            $txt .= "还差<span>" . $nowgroupneednum . "</span>人 立即邀请好友";

        }else{
            if ($config['maxcountall']>1){
                if ($config['tuanmode']==0 || $config['tuanmode']==2){
                    $txt .= "          — 已拼成功 —\n";
                }elseif ($config['tuanmode']==1 || $config['tuanmode']==3){
                    $txt .= "          — 已拼成,还可继续加入,共享福利 —\n";
                }
            }
        }
    }
    $txt .= "</a>\n";
    $txt .=  " </div>\n";
    $result['pin'] = Theme::encode($txt);
}


$result['errcode'] = 0;
return_msg($result, '', 'ajax');

//footmenu 底部菜单
//teamAlt 是点立即抢购弹出的拼团页面；这个没有设计样式，看能不能把yx2020的挪过来
}
}